{{- if or (hasKey .Values.certManager "cloudflareGlobalAPIKey") (hasKey .Values.certManager "cloudflareAPIToken") }}
---
apiVersion: v1
kind: Secret
metadata:
  name: cloudflare
  namespace: d8-cert-manager
  {{- include "helm_lib_module_labels" (list . (dict "app" "cert-manager")) | nindent 2 }}
data:
  {{- if and (hasKey .Values.certManager "cloudflareGlobalAPIKey") (.Values.certManager.cloudflareGlobalAPIKey) }}
  global-api-key: {{ .Values.certManager.cloudflareGlobalAPIKey | b64enc | quote }}
  {{- end }}
  {{- if and (hasKey .Values.certManager "cloudflareAPIToken") (.Values.certManager.cloudflareAPIToken) }}
  api-token: {{ .Values.certManager.cloudflareAPIToken | b64enc | quote }}
  {{- end }}
{{- end }}
